public class Solution {
    public int[] singleNumber(int[] nums) {
        int t = 0;
        for(int num : nums) {
            t ^= num;
        }
        int tbit = 0x00000001;
        for(int i = 0; i < 31; i++) {
            if((tbit & t) != 0) {
                break;
            }
            tbit <<= 1;
        }
        int ab = 0;
        for(int num : nums) {
            if((num & tbit) != 0) {
                ab ^= num;
            }
        }
        return new int[]{ab, t^ab};
    }
}